#ifndef TRIAC_CONTROL_H
#define TRIAC_CONTROL_H
    
/*----------------------------------------------------------------------------*/
/* Included files to resolve specific definitions in this file                */
/*----------------------------------------------------------------------------*/
#include "basedef.h"

/*----------------------------------------------------------------------------*/
/* Constant data                                                              */
/*----------------------------------------------------------------------------*/
#define TRIAC_FIRE_TIME		20u			//triac fire time in task1 periods -->1000us

/*----------------------------------------------------------------------------*/
/* Exported type                                                              */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Exported data                                                              */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Constant exported data                                                     */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Exported Macros                                                            */
/*----------------------------------------------------------------------------*/
/* Triac control */
#define _FIRE_TRIAC()(			\
{								\
pinTH_FIRE = 1;					\
_set_triac_state(1);			\
_set_over_prot_triac_state(1);	\
})	

#define _TRIAC_OFF()(			\
{								\
pinTH_FIRE = 0;					\
_set_triac_state(0);			\
})	

#define _TRIAC()			pinTH_FIRE



/*----------------------------------------------------------------------------*/
/* Exported functions           				          				      */
/*----------------------------------------------------------------------------*/
void triac_fire_timer(void);
void triac_control_init(void);

#endif /* TRIAC_CONTROL_H */
